const usertags={
    name: "users",
    description: "用户管理模块",
  }
const userschemas={
    users: {
        // 用来描述用户的属性
        properties: {
          _id: {
            type: "string",
            description: "用户唯一标识",
          },
          username: {
            type: "string",
            description: "用户名",
          },
          password: {
            type: "string",
            description: "用户密码",
          },
        },
      },
      loginReturn: {
        properties: {
          status: {
            type: "boolean",
            description:
              "是否登录成功状态，true 为登录成功，false 为登录失败",
          },
        },
      },
      regReturn: {
        properties: {
          status: {
            type: "boolean",
            description:
              "是否注册成功状态，true 为注册成功，false 为注册失败",
          },
        },
      },
}
const userpaths={
    "/users/login": {
        post: {
          tags: ["users"],
          summary: "用户登录",
          description: "这是一个用户登录功能",
          // 请求的数据类型 json
          consumes: ["application/json"],
          // 请求参数
          requestBody: {
            // 必填
            required: true,
            // 内容
            content: {
              "application/json": {
                // 结构
                schema: {
                  $ref: "#/components/schemas/users",
                },
                example: {
                  username: "zhangsan",
                  password: "123456",
                },
              },
            },
          },
          responses: {
            // http 状态码
            200: {
              description: "操作成功",
              content: {
                "application/json": {
                  schema: {
                    $ref: "#/components/schemas/loginReturn",
                  },
                },
              },
            },
            404: {
              description: "找不到资源",
            },
            500: {
              description: "服务端内部错误",
            },
          },
        },
      },
      "/users/reg": {
        post: {
          tags: ["users"],
          summary: "用户注册",
          description: "这是一个用户注册功能",
          // 请求参数
          requestBody: {
            // 必填
            required: true,
            // 内容
            content: {
              "application/json": {
                // 结构
                schema: {
                  $ref: "#/components/schemas/users",
                },
                example: {
                  username: "zhangsan",
                  password: "123456",
                },
              },
            },
          },
          responses: {
            // http 状态码
            200: {
              description: "操作成功",
              content: {
                "application/json": {
                  schema: {
                    $ref: "#/components/schemas/regReturn",
                  },
                },
              },
            },
            404: {
              description: "找不到资源",
            },
            500: {
              description: "服务端内部错误",
            },
          },
        },
      },
}
module.exports ={usertags,userschemas,userpaths}